/**
 * 
 */
package ru.opedge.notifical.util;

import java.util.Iterator;

/**
 * @author opedge
 * 
 */
public class StringLengthSplitter implements Iterable<String>
{
	private final int maxLength;

	private final String text;

	/**
	 * @param maxLength
	 *            - max length of each substring
	 */
	public StringLengthSplitter(final String text, final int maxLength)
	{
		this.maxLength = maxLength;
		this.text = text;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Iterable#iterator()
	 */
	@Override
	public Iterator<String> iterator()
	{
		return new StringLengthIterator(text, maxLength);
	}

}
